<?php
/**
 * Single Product Price, including microdata for SEO
 *
 * @author 		WooThemes
 * @package 	WooCommerce/Templates
 * @version     1.6.4
 */

global $post, $product;
?>

<?php
	$listprice = get_post_custom($post->ID);
	$showlistprice = $listprice['_regular_price'];
	foreach ( $showlistprice as $showlistprice );
	
	$youpay = get_post_custom($post->ID);
	$showyoupay = $youpay['_sale_price'];
	foreach ( $showyoupay as $showyoupay );
	
        if($showlistprice != 0) {
        
            $savings = (($showlistprice - $showyoupay) / $showlistprice);
            $showsavings = $savings * 100;
        
        }
	
	// Call The Product SKU For Display
	$productsku = get_post_custom($post->ID);
	$showsku = $productsku['_sku'];
	foreach ( $showsku as $showsku );
	
	$productstockstatus = get_post_custom($post->ID);
	$showstockstatus = $productstockstatus['_stock_status'];
	if ($showstockstatus = 'instock') {
		$showstockstatus = 'In Stock &amp; Available For Sale';
	} else {
		$showstockstatus = 'Please Call For Availability';
	}

?>

<div itemprop="offers" itemscope itemtype="http://schema.org/Offer" style="padding-top:10px;padding-bottom:10px;">
    <?php if($showlistprice != 0) { ?>
        <div class="offerLeft">
            <p class="price" style="visibility:hidden;"><?php echo $product->get_price_html(); ?></p>
            <p style="margin-bottom:5px;"><strong>SKU: <span itemprop="identifier" content="sku:<?php echo $showsku; ?>"><?php echo $showsku ; ?></span></strong></p>
        </div>
        <div class="offerRight">
            <p class="productYouPay">$<meta itemprop="currency" content="USD" /><span itemprop="price"><?php echo $showyoupay ; ?></span></p>
            <p class="productListPrice">List Price: <span class="listprice">$<?php echo $showlistprice ; ?></span></p>
            <p class="productSavings">SAVE <span><?php echo round($showsavings) ; ?>%</span></p>
        </div>
    <?php } else { ?>
        <p style="margin-bottom:5px;"><strong>SKU: <span itemprop="identifier" content="sku:<?php echo $showsku; ?>"><?php echo $showsku ; ?></span></strong></p>
        <p itemprop="price" class="price"><?php echo $product->get_price_html(); ?></p>
    <?php } ?>

    <div style="width:100%;height:1px;background:#cccccc;margin-top:10px;margin-bottom:10px;clear:both;"></div>

    <div class="productpageform">
        <link itemprop="availability" href="http://schema.org/<?php echo $product->is_in_stock() ? 'InStock' : 'OutOfStock'; ?>" />
    </div>

</div>